package pruebas;

import core.JTextFieldLimit;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class PruebaTxtLimit extends JFrame {

    JTextField textfield1;

    JLabel label1;

    public static void main(String[] args) {
        PruebaTxtLimit p = new PruebaTxtLimit();
        p.setLayout(new FlowLayout());
        p.setLabel1(new JLabel("max 2 chars"));
        p.setTextfield1(new JTextField(15));
        p.add(p.getLabel1());
        p.add(p.getTextfield1());
        p.getTextfield1().setDocument(new JTextFieldLimit(2));
        p.setSize(300, 300);
        p.setVisible(true);
    }

    public void setTextfield1(JTextField textfield1) {
        this.textfield1 = textfield1;
    }

    public void setLabel1(JLabel label1) {
        this.label1 = label1;
    }

    public JTextField getTextfield1() {
        return textfield1;
    }

    public JLabel getLabel1() {
        return label1;
    }

}
